<template>
  <div style="margin-top:15px;">
    <!--订单信息-->
    <OrderInfo :chOrderService="chOrderService" :id="id" :routeName="routeName"></OrderInfo>
    <!--客户信息：入库单STORAGEORDERTYPE02 无，服务单STORAGEORDERTYPE01有-->
    <UserInfo :chOrderConsigneeInfo="chOrderConsigneeInfo" v-if="chOrderService.orderType === 'STORAGEORDERTYPE01'"></UserInfo>
    <!--商品信息-->
    <PackageTable :value="productDetailBeans" :productType="productType" :totalInfo="chOrderService"></PackageTable>
    <!--<OperationRecord :chVersionHistories="chVersionHistories"></OperationRecord>-->
  </div>
</template>
<script>
import OrderInfo from '@/views/oms/enterWarehouse/warehousingOrder/OrderInfo'
import UserInfo from '@/views/oms/enterWarehouse/warehousingOrder/UserInfo'
import PackageTable from '@/views/oms/business/PackageTable'
import OperationRecord from '@/views/oms/enterWarehouse/warehousingOrder/OperationRecord'
import {dotData} from '@/utils'
export default {
  name: 'warehousingOrderShow',
  components: {
    OperationRecord,
    OrderInfo,
    PackageTable,
    UserInfo
  },
  data() {
    return {
      id: this.$route.params.id,
      routeName: this.$route.name,
      chOrderService: {},
      productDetailBeans: [],
      chVersionHistories: [],
      chOrderConsigneeInfo: {}
    }
  },
  created() {
    this.getDetail()
  },
  computed: {
    // 标准产品1，通用产品2==自定义产品3
    productType() {
      return dotData(this.chOrderService, 'productType') || 1 // 默认为标准产品
    }
  },
  methods: {
    getDetail() {
      this.$ajax.get('/ms-warehouse-order/recordOrder/orderDetailBean', {id: this.id}).then(response => {
        if (response.success) {
          this.chOrderService = response.data.chOrderService || {} // 订单信息
          this.productDetailBeans = response.data.productDetailBeans || []
          this.chVersionHistories = response.data.chVersionHistories || []
          this.chOrderConsigneeInfo = response.data.chOrderConsigneeInfo || {} // 客户信息
        }
      })
    },
    jump() {
      this.$router.push({path: '/ss-oms/enterWarehouse/warehousing-order/edit/' + this.id})
    }
  }
}
</script>
